﻿<html>

<head>

<!--COMMON :include style and javascript code-->
${inc:/action/pub/common}

<title>量房录入信息</title>

</head>

<body onmouseup="hidInputValidatorTip(3);">
<!--a name="A0" id="A0"></a-->

<!--COMMON HEADER-->
${inc:/action/pub/header}

<center>

<!--filter form-->
<div id="divFilter" style="display:none;width:100%">
</div>

<!--addnew/edit form-->
<div id="divEditor" style="display:none;width:100%">
</div>

<!--insert/update response-->
<div id="divEditorResponse" style="display:none;width:100%">
</div>

<!--grid view response-->
<div id="response" style="display:none;width:100%">
</div>

<!--progress indicator-->
<div id="divStatus" class="alert" style="text-align:left; display:none;color:gray;width:150px;font-weight:bold;font-family:Arial">
    <img src="${def:context}/images/progress.gif"> 请稍候...
</div>

<!--show linked grid-->
<iframe id="detail" name="detail" marginwidth="0" scrolling="no" frameborder="0" style="height:0%;width:100%;visibility:hidden">
</iframe>

<!--用于传递当前目录到header模版中-->
<input type="hidden" name="actionroot" id="actionroot" value="${def:actionroot}">

</center>

</body>

</html>

<SCRIPT LANGUAGE="JavaScript">
//计算院内设施总额
function countYuanneiFee(){
	var array = new Array("dijiao2","shu2","shuijin_shouya2","chuqinshepeng2","shuijin_qita2",
						"zhaoqichi2","yuanqiang2","teshuguoshu_l12","teshuguoshu_l22",
						"teshuguoshu_l32","teshuguoshu_l42","teshuguoshu_l52","zhujuan2",
						"zilaishui2","cesuo2","shuinishe2","dianhua2","youxiandianshi2",
						"menlou_yi2","menlou_er2","fengbiyuanqiangmen2","banfengbiyuanqiangmen2");
	var totalFee = 0;
	for(var i=0;i<array.length;i++){
		var obj = document.forms["formEditor"].elements[array[i]];
		if(Trim(obj.value)==""){
			continue;
		}
		totalFee += parseFloat(Trim(obj.value));
	}
	document.forms["formEditor"].elements["total_fee"].value = eval((Math.round(totalFee*100))/100);
}

function onBlurHandler(price,ge,show){
	var p = document.forms["formEditor"].elements[price];
	var g = document.forms["formEditor"].elements[ge];
	var s = document.forms["formEditor"].elements[show];
	if(Trim(p.value)=="" || Trim(g.value)==""){
		return false;
	}
	var pVal = parseFloat(p.value);
	var gVal = parseFloat(g.value);
	if(gVal >= 0){
		var output = eval((Math.round(pVal*gVal*100))/100);
		s.value = output;
	}else{
		alert("请输入正确格式");
		g.focus();
		g.select();
		return false;
	}
	countYuanneiFee();
}

function MyCheckDouble(val)
{
	var obj = document.forms["formEditor"].elements[val];
    var input = obj.value;
	if(input == "") return true;
    var pos1 = input.indexOf(".");
    var pos2 = input.lastIndexOf(".");
    var charset = "1234567890.";
    if ((pos1 != pos2)||(!CheckChar(charset, input, true))) {
        alert ("请输入正确格式，只可包含数字和一个“.”！");
        obj.focus();
        obj.select();
        return false;
    }
	var output = eval((Math.round(input*100))/100);
	obj.value=output;
    
    return true;
}

var nameArray = new Array("zf_number1","zf_area1","zf_number2","zf_area2","xf_area1","xf_area2","xf_area3","xf_area4"
						  ,"xf_area5","xf_area6","dijiao","shu","shuijin_shouya","shuijin_qita","chuqinshepeng"
						  ,"guoshu","zhaoqichi","yuanqiang","zhujuan","zilaishui","cesuo","shuinishe","dianhua"
						  ,"youxiandianshi","menlou_yi","menlou_er","fengbiyuanqiangmen","banfengbiyuanqiangmen"
						  ,"teshuguoshu_l1","teshuguoshu_l2","teshuguoshu_l3","teshuguoshu_l4","teshuguoshu_l5");
var parentArray = new Array();

function setArray(arr){
	parentArray = arr;
}

//字段校验
function checkFields(){
	if(document.formEditor.master_tuid.value == ""){
		alert("请选择新的户主！");
		return false;
	}
	if(CheckNull("project_name","formEditor","请选择项目名称！")) return false;
//	if(!CheckRadio("user_sex","请选择性别","","formEditor")) return false;
//  if(!CheckRadio("is_local","请选择是否为坐地户","","formEditor")) return false;
//	if(!CheckRadio("single_status","请选择离婚丧偶情况","","formEditor")) return false;
//	if(!CheckRadio("is_onechild","请选择是否独生子女","","formEditor")) return false;
	if(!CheckRadio("is_touqin","请选择是否投亲","","formEditor")) return false;

    if(!CheckNullNum("zf_number1"))return false;
	if(!MyCheckDouble("zf_area1"))return false;
	if(!MyCheckDouble("zf_price1"))return false;
	if(!CheckNullNum("zf_number2"))return false;
	if(!MyCheckDouble("zf_area2"))return false;
	if(!MyCheckDouble("zf_price2"))return false;

	if(!MyCheckDouble("xf_area1"))return false;
	if(!MyCheckDouble("xf_price1"))return false;
	if(!MyCheckDouble("xf_total1"))return false;
	if(!MyCheckDouble("xf_area2"))return false;
	if(!MyCheckDouble("xf_price2"))return false;
	if(!MyCheckDouble("xf_total2"))return false;
	if(!MyCheckDouble("xf_area3"))return false;
	if(!MyCheckDouble("xf_price3"))return false;
	if(!MyCheckDouble("xf_total3"))return false;
	if(!MyCheckDouble("xf_area4"))return false;
	if(!MyCheckDouble("xf_price4"))return false;
	if(!MyCheckDouble("xf_total4"))return false;
	if(!MyCheckDouble("xf_area5"))return false;
	if(!MyCheckDouble("xf_price5"))return false;
	if(!MyCheckDouble("xf_total5"))return false;
	if(!MyCheckDouble("xf_area6"))return false;
	if(!MyCheckDouble("xf_price6"))return false;
	if(!MyCheckDouble("xf_total6"))return false;

	if(!MyCheckDouble("dijiao"))return false;
	if(!MyCheckDouble("dijiao2"))return false;
	if(!CheckNullNum("shu"))return false;
	if(!MyCheckDouble("shu2"))return false;
	if(!CheckNullNum("shuijin_shouya"))return false;
	if(!MyCheckDouble("shuijin_shouya2"))return false;
	if(!CheckNullNum("shuijin_qita"))return false;
	if(!MyCheckDouble("shuijin_qita2"))return false;
	if(!MyCheckDouble("chuqinshepeng"))return false;
	if(!MyCheckDouble("chuqinshepeng2"))return false;
	if(!CheckNullNum("guoshu"))return false;
	if(!MyCheckDouble("guoshu2"))return false;

	if(!CheckNullNum("zhaoqichi"))return false;
	if(!MyCheckDouble("zhaoqichi2"))return false;
	if(!MyCheckDouble("yuanqiang"))return false;
	if(!MyCheckDouble("yuanqiang2"))return false;
	if(!CheckNullNum("teshuguoshu_l1"))return false;
	if(!MyCheckDouble("teshuguoshu_l12"))return false;
	if(!CheckNullNum("zhujuan"))return false;
	if(!MyCheckDouble("zhujuan2"))return false;
	if(!CheckNullNum("zilaishui"))return false;
	if(!MyCheckDouble("zilaishui2"))return false;
	if(!CheckNullNum("teshuguoshu_l2"))return false;
	if(!MyCheckDouble("teshuguoshu_l22"))return false;
	if(!CheckNullNum("teshuguoshu_l3"))return false;
	if(!MyCheckDouble("teshuguoshu_l32"))return false;
	if(!CheckNullNum("cesuo"))return false;
	if(!MyCheckDouble("cesuo2"))return false;
	if(!MyCheckDouble("shuinishe"))return false;
	if(!MyCheckDouble("shuinishe2"))return false;
	if(!CheckNullNum("teshuguoshu_l4"))return false;
	if(!MyCheckDouble("teshuguoshu_l42"))return false;
	if(!CheckNullNum("teshuguoshu_l5"))return false;
	if(!MyCheckDouble("teshuguoshu_l52"))return false;

	if(!CheckNullNum("dianhua"))return false;
	if(!MyCheckDouble("dianhua2"))return false;
	if(!CheckNullNum("youxiandianshi"))return false;
	if(!MyCheckDouble("youxiandianshi2"))return false;
	if(!CheckNullNum("menlou_yi"))return false;
	if(!MyCheckDouble("menlou_yi2"))return false;
	if(!CheckNullNum("menlou_er"))return false;
	if(!MyCheckDouble("menlou_er2"))return false;
	if(!CheckNullNum("fengbiyuanqiangmen"))return false;
	if(!MyCheckDouble("fengbiyuanqiangmen2"))return false;
	if(!CheckNullNum("banfengbiyuanqiangmen"))return false;
	if(!MyCheckDouble("banfengbiyuanqiangmen2"))return false;

	if(document.formEditor.liangfang_remak.value.length > 250){
		alert("备注信息长度不能超过250，请检查！");
		document.formEditor.liangfang_remak.focus();
		document.formEditor.liangfang_remak.select();
		return false;
	}

	if(parentArray.length == nameArray.length){
		for(var i=0;i<nameArray.length;i++){
			var obj = document.forms["formEditor"].elements[nameArray[i]];
			if(Trim(obj.value)=="") continue;
			if(parseFloat(obj.value) > parseFloat(parentArray[i])){
				alert("分户后的数据不能大于分户前的数据，请检查！");
				obj.focus();
				obj.select();
				return false;
			}
		}
	}

    return true;
}

function pickLevels(id,desc,flag){
	var url = "${def:context}/action/dq/pick/house-level/form";
	pickOpen (desc,id,url,'400','230',null,flag);
}

function pickMembers(id,desc){
	var parent_id = document.formEditor.parent_master_tuid.value;
	var url = "${def:context}/action/dq/pick/members?id="+parent_id;
	pickOpen (desc,id,url,'200','200');
}

function searchBack(){
    document.getElementById("divFilter").style.display = "";
	formHidden();
}

function policyValue(){
	//单价赋值（除了正房小房）
	document.formEditor.dijiao_policy.value = "${fld:dijiao_policy}";
	document.formEditor.shu_policy.value = "${fld:shu_policy}";
	document.formEditor.shuijin_shouya_policy.value = "${fld:shuijin_shouya_policy}";
	document.formEditor.shuijin_qita_policy.value = "${fld:shuijin_qita_policy}";
	document.formEditor.chuqinshepeng_policy.value = "${fld:chuqinshepeng_policy}";
	document.formEditor.guoshu_policy.value = "${fld:guoshu_policy}";
	document.formEditor.zhaoqichi_policy.value = "${fld:zhaoqichi_policy}";
	document.formEditor.yuanqiang_policy.value = "${fld:yuanqiang_policy}";
	document.formEditor.zhujuan_policy.value = "${fld:zhujuan_policy}";
	document.formEditor.zilaishui_policy.value = "${fld:zilaishui_policy}";
	document.formEditor.cesuo_policy.value = "${fld:cesuo_policy}";
	document.formEditor.shuinishe_policy.value = "${fld:shuinishe_policy}";
	document.formEditor.teshuguoshu_l1_policy.value = "${fld:teshuguoshu_l1_policy}";
	document.formEditor.teshuguoshu_l2_policy.value = "${fld:teshuguoshu_l2_policy}";
	document.formEditor.teshuguoshu_l3_policy.value = "${fld:teshuguoshu_l3_policy}";
	document.formEditor.teshuguoshu_l4_policy.value = "${fld:teshuguoshu_l4_policy}";
	document.formEditor.teshuguoshu_l5_policy.value = "${fld:teshuguoshu_l5_policy}";
	document.formEditor.dianhua_policy.value = "${fld:dianhua_policy}";
	document.formEditor.youxiandianshi_policy.value = "${fld:youxiandianshi_policy}";
	document.formEditor.menlou_yi_policy.value = "${fld:menlou_yi_policy}";
	document.formEditor.menlou_er_policy.value = "${fld:menlou_er_policy}";
	document.formEditor.fengbiyuanqiangmen_policy.value = "${fld:fengbiyuanqiangmen_policy}";
	document.formEditor.banfengbiyuanqiangmen_policy.value = "${fld:banfengbiyuanqiangmen_policy}";
}

function addNewBackSetting(){
	//单价赋值（除了正房小房）
    policyValue();
}


loadEditor();
loadFilter(search);

function formIFrameAnzhi(id)
{
	$("detail").style.visibility = "visible"; 
	$("detail").style.height = "100%"; 
	$("detail").src ='${def:context}${def:actionroot}/placement/crud?id=' + id;
}

function formHidden(flag)
{
	$("detail").style.visibility = "hidden"; 
	$("detail").style.height = "0%"; 
	if(flag == true){
		search();
	}
}
</script>
    